<template>
  <div class="subject">
    <span>{{msg1}}</span>
    <span>+</span>
    <span>{{msg2}}</span>
    <span>=</span>
    <input type="number" v-model.number="num"/>
    <button @click="$emit('click-event',num===msg1+msg2,num)">提交</button>
  </div>
</template>

<script>
export default {
  props:{},
  data() {
    return {
      msg1:Math.floor(Math.random()*11),
      msg2:Math.floor(Math.random()*11),
      num:''
    }
  },
  methods: {
    
  } 
};
</script>

<style scoped>
.subject {
  margin: 5px;
  padding: 5px;
  font-size: 20px;
}
.subject span {
  display: inline-block;
  text-align: center;
  width: 20px;
}
.subject input {
  width: 50px;
  height: 20px;
}
</style>